version := i686-linux-gnu-

W := -Wall -Wextra -Wno-unknown-pragmas \
		-Wno-unused-function \
		-Wno-unused-variable\
		-Wno-unused-but-set-variable \
		-Wno-unused-parameter \
		-Wno-discarded-qualifiers\
		-Werror=incompatible-pointer-types

CC 			= $(version)gcc-12
CFLAG 		= -m32 \
			-march=i386 \
			-std=gnu99 \
			-nostdlib \
			$(W) \
			-fno-pic \
			-ffreestanding \
			-mpreferred-stack-boundary=2 \
			-D__DEBUG__ \
			-c
MOVE 		= mv
DD 			= dd
LD 			= $(version)ld
LDFLAG 		= -T linker.ld
AS 			= $(CC)
ASFLAG 		= -m32 -c

QEMU_MON_TERM := gnome-terminal
QEMU_MON_PORT := 45454


QEMU_OPTIONS_NONDEBUG := -m 48 \
				-rtc base=utc \
				-no-reboot \
				-machine q35 \
				-no-shutdown \
				-d trace:ide_dma_cb,trace:ahci_cmd_done \
				-boot order=dc \
				-device ahci,id=ahci \
				-drive id=cdrom,file="disk.iso",readonly=on,if=none,format=raw \
				-drive id=disk,file="mp/disk.img",if=none \
				-device ide-hd,drive=disk,bus=ahci.0 \
				-device ide-cd,drive=cdrom,bus=ahci.1
				
QEMU_OPTIONS := -s -S -m 48 \
				-rtc base=utc \
				-no-reboot \
				-machine q35 \
				-serial tcp::12345,server,nowait\
				-no-shutdown \
				-d trace:ide_dma_cb,trace:ahci_cmd_done \
				-boot order=dc \
				-device ahci,id=ahci \
				-drive id=cdrom,file="disk.iso",readonly=on,if=none,format=raw \
				-drive id=disk,file="mp/disk.img",if=none \
				-device ide-hd,drive=disk,bus=ahci.0 \
				-device ide-cd,drive=cdrom,bus=ahci.1 \
				-monitor telnet::$(QEMU_MON_PORT),server,nowait &
